# /usr/bin/env python
# -*- coding: utf8 -*-
# title       :
# description :
# author      :'ShenMeng'

import maya.cmds as cmds


class Validation(object):
    name = u'Constrain | 约束节点检查'
    description = u"""检查场景是够有约束节点"""
    dataDict = dict()

    constraintTypeList = ["pointConstraint",
                          "pointOnPolyConstraint",
                          "aimConstraint",
                          "orientConstraint",
                          "parentConstraint",
                          "scaleConstraint",
                          "normalConstraint",
                          "tangentConstraint",
                          "geometryConstraint",
                          "motionPath"]

    def execute(self):
        self.dataDict = {}

        for constraintType in self.constraintTypeList:
            constraintList = cmds.ls(type=constraintType)
            if constraintList:
                self.dataDict[constraintType] = constraintList
        return self.dataDict

    def correct(self):
        cmds.delete(cmds.ls(type=self.constraintTypeList))

    def search(self, obj):
        cmds.select(cmds.ls(type=obj))
